home *** CD-ROM | disk | FTP | other *** search
/ JCSM Shareware Collection 1996 September / JCSM Shareware Collection (JCS Distribution) (September 1996).ISO / prgtools / sharee17.zip / CRYPTO.H < prev    next >
Text File  |  1994-06-04  |  5KB  |  83 lines

  1. /* 06/04/94 */
  2.  
  3. #define SHIFTLENGTH    8
  4.  
  5. /* Cesar: single character */
  6. void CesarEncodeChar(unsigned char *Char, short Base, short Key1, short Key2, short Key3);
  7. void CesarDecodeChar(unsigned char *Char, short Base, short Key1, short Key2, short Key3);
  8. /* Char: character to be crypted; contains result afterwards */
  9. /* Base: base of calculation (must be varied for longer strings to prevent obvious code) */
  10. /* Key 1, 2, 3: keys in the range -256 to 256 */
  11. /* base and keys must be identical for encryption and decryption */
  12.  
  13. /* Cesar: string */
  14. void CesarEncodeString(unsigned char *String, short Key1, short Key2, short Key3, unsigned char FirstChar, unsigned char LastChar);
  15. void CesarDecodeString(unsigned char *String, short Key1, short Key2, short Key3, unsigned char FirstChar, unsigned char LastChar);
  16. /* String: null-terminated string to be crypted; contains result afterwards */
  17. /* Key 1, 2, 3: keys in the range -256 to 256 */
  18. /* FirstChar, LastChar: ASCII range of input and output string (e.g. numbers are coded into numbers) */
  19. /* keys must be identical for encryption and decryption */
  20.  
  21. /* Cesar: binary file */
  22. void CesarEncodeBytes(char *InputFilename, char *OutputFilename, short Key1, short Key2, short Key3);
  23. void CesarDecodeBytes(char *InputFilename, char *OutputFilename, short Key1, short Key2, short Key3);
  24. /* InputFilename, OutputFilename: DOS file names of input and output file */
  25. /* Key 1, 2, 3: keys in the range -256 to 256 */
  26. /* keys must be identical for encryption and decryption */
  27.  
  28. /* Cesar: text file */
  29. void CesarEncodeLines(char *InputFilename, char *OutputFilename, short Key1, short Key2, short Key3, unsigned char FirstChar, unsigned char LastChar);
  30. void CesarDecodeLines(char *InputFilename, char *OutputFilename, short Key1, short Key2, short Key3, unsigned char FirstChar, unsigned char LastChar);
  31. /* InputFilename, OutputFilename: DOS file names of input and output file */
  32. /* Key 1, 2, 3: keys in the range -256 to 256 */
  33. /* FirstChar, LastChar: ASCII range of input and output string (e.g. numbers are coded into numbers) */
  34. /* keys must be identical for encryption and decryption */
  35.  
  36. /* Bit Shift: single character */
  37. void ShiftEncodeChar(unsigned char *Char, short Base, short Start, short LoopA, short LoopB);
  38. void ShiftDecodeChar(unsigned char *Char, short Base, short Start, short LoopA, short LoopB);
  39. /* Char: character to be crypted; contains result afterwards */
  40. /* Base: base of calculation (must be varied for longer strings to prevent obvious code) */
  41. /* Start: initial value of shift register; LoopA, LoopB: bits to be recycled */
  42. /* base and keys must be identical for encryption and decryption */
  43.  
  44. /* Bit Shift: string */
  45. void ShiftEncodeString(unsigned char *String, short Start, short LoopA, short LoopB, unsigned char FirstChar, unsigned char LastChar);
  46. void ShiftDecodeString(unsigned char *String, short Start, short LoopA, short LoopB, unsigned char FirstChar, unsigned char LastChar);
  47. /* String: null-terminated string to be crypted; contains result afterwards */
  48. /* Start: initial value of shift register; LoopA, LoopB: bits to be recycled */
  49. /* FirstChar, LastChar: ASCII range of input and output string (e.g. numbers are coded into numbers) */
  50. /* keys must be identical for encryption and decryption */
  51.  
  52. /* Bit Shift: binary file */
  53. void ShiftEncodeBytes(char *InputFilename, char *OutputFilename, short Start, short LoopA, short LoopB);
  54. void ShiftDecodeBytes(char *InputFilename, char *OutputFilename, short Start, short LoopA, short LoopB);
  55. /* InputFilename, OutputFilename: DOS file names of input and output file */
  56. /* Start: initial value of shift register; LoopA, LoopB: bits to be recycled */
  57. /* keys must be identical for encryption and decryption */
  58.  
  59. /* Bit Shift: text file */
  60. void ShiftEncodeLines(char *InputFilename, char *OutputFilename, short Start, short LoopA, short LoopB, unsigned char FirstChar, unsigned char LastChar);
  61. void ShiftDecodeLines(char *InputFilename, char *OutputFilename, short Start, short LoopA, short LoopB, unsigned char FirstChar, unsigned char LastChar);
  62. /* InputFilename, OutputFilename: DOS file names of input and output file */
  63. /* Start: initial value of shift register; LoopA, LoopB: bits to be recycled */
  64. /* FirstChar, LastChar: ASCII range of input and output string (e.g. numbers are coded into numbers) */
  65. /* keys must be identical for encryption and decryption */
  66.  
  67. /* Bit Shift: period length */
  68. short ShiftPeriod(short Start, short LoopA, short LoopB);
  69. /* Start: initial value of shift register; LoopA, LoopB: bits to be recycled */
  70. /* Return value: period length of specified shift register */
  71.  
  72. /* User ID: */
  73. long IDCalculate(char *Name, short Key1, short Key2);
  74. /* Name: name to be calculated, null-terminated; remains unchanged */
  75. /* Key 1, 2: keys in the range -256 to +256 */
  76. /* Return value: a five digit ID */
  77. void IDShortName(char *Name, char *ShortName);
  78. /* Name: name to be shortened, null-terminated; remains unchanged */
  79. /* Return value: shortened name in ShortName */
  80. void IDLongName(char *Name, char *LongName);
  81. /* Name: name to be lengthened, null-terminated; remains unchanged */
  82. /* Return value: lengthened name in LongName */
  83.